$(function () {

    $("body").on("click","#save",function(){
        var params ={};
        params.id=$("input[name='id']").val();
        params.receiver=$("input[name='receiver']").val();
        params.mobile=$("input[name='mobile']").val();;
        params.address=$("textarea[name='address']").val();
        var citys =  $("#page-city-picker").val();
        params.status=status;
        params.citys=citys;
        params = JSON.stringify(params);

        $.ajax({
            url:  baseloaction + "/mobile/uc/userInfo/initAddUserAddress",
            type: "post",
            data:params,
            dataType: "json",
            contentType: 'application/json;charset=utf-8',
            success: function (result) {
                Zepto.toast( result.message);
                if (result.success == true) {

                }
            },
            error: function (error) {
                Zepto.toast("系统错误");
            }
        });
    });

    var oneData=$("input[name='province']").val();
    if(oneData!=''){
        oneData =oneData+'-';
    }
    var twoData=$("input[name='city']").val();
    var threeData=$("input[name='town']").val();
    if(threeData!=''){
        twoData = twoData+'-';
    }
setTimeout(function(){

    $("#page-city-picker").cityPicker({
        value: ["", "",""],
        formatValue: function (p, values, displayValues) {
            var value  =   displayValues[0] + '-' + values[1];
            if(values[2]!=''){
                value+='-' + values[2];
            }
            return value
        }
    });

    $("#page-city-picker").val(oneData+twoData+threeData);
},300)


});



